/**
 * TODO
 *
 * @author kfzx-weiwf
 * @since 2017-4-25 下午04:21:30
 */
package com.icbc.api;

import java.net.URLEncoder;

import org.junit.Test;

import com.icbc.api.internal.util.internal.util.fastjson.JSONObject;
import com.icbc.api.request.BabyCardVerifyRequestV1;
import com.icbc.api.request.BabyCardVerifyRequestV1.BabyCardVerifyRequestBizV1;
import com.icbc.api.response.BabyCardVerifyResponseV1;



/**
 * TODO
 *
 *
 * @author kfzx-weiwf
 * @since 2017-4-25 下午04:21:30
 */
public class BabyCardVerifyTestV1 {

	protected static final String MY_PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJzmVuvWsHiSYS+Q/LzkXf5GVEDGOZk45/Z1R/Tivp/dh3rQhuO3PysUEGAMjGBZE7cfFzoClT8L76ozxe2Oq55KI7nqfjPX53VShy7w/qD3TX7LrwA7Ly+rPHrK/giAhOxdBTBm9kvlvKcXWodnJeYp+7l5w8VLNirHHaYK+1PJAgMBAAECgYB6X/3zvGOv5xv+Kau2+LeHF/um+fT62TOzOw6ApkngDr0YwYQ0ID0YsHGFOMRUcaW68nj/OfyGTB0GN5NtEhYwCrvwolE58Lv5gc7LtvBohC1sZFF6mu8heMwKIdu2B3XzyEZX6OYhXheDtV9eIbBhr5SSdzMWXct5npc6muNKwQJBANMmRxAd5nH+T1rn6c1QAEPYwYuHPpSwTP/6aAA+jshcN3+Ir+/sa0qemQ5d3F3HZRR7LeXTj9echmI92z8lwg0CQQC+OhyABMVYVsHGI7Mhk/yb3hv6MO/YFpzBL7+qhp9s5UeYQxtSpg/xRjtTMX9Mr+GAm0djHEX0SDYkkH8AVLWtAkEAiN+QQ0dOoeh7om8hZSEN+u0gkYULMTGTyH+XOUlUH1d/9mExw3JbHpTunJyFhBkEUiGDYC8jWF4z0q1MWYPtZQJAfds0v/5oEupTiiRUgALJPtbU69M03GMZkzdkOA6ZrBKGK9c6XJRCN/+fgItfDf3P1KbntEsgfV7Jc6emXzGsgQJAeVmjgI24MP2aLxqFUH3oD5rZIIsBu2N3MZ0xWywS0cE59NLPL6vu4+zEhm1YcjMouXJFKTWdc59r4/2KwDBlfw==";

	protected static final String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwFgHD4kzEVPdOj03ctKM7KV+16bWZ5BMNgvEeuEQwfQYkRVwI9HFOGkwNTMn5hiJXHnlXYCX+zp5r6R52MY0O7BsTCLT7aHaxsANsvI9ABGx3OaTVlPB59M6GPbJh0uXvio0m1r/lTW3Z60RU6Q3oid/rNhP3CiNgg0W6O3AGqwIDAQAB";

	protected static final String APP_ID = "10000000000000002173";

	@Test
	public void test_cop() throws IcbcApiException {
		
		
		DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, MY_PRIVATE_KEY, APIGW_PUBLIC_KEY);

		BabyCardVerifyRequestV1 request = new BabyCardVerifyRequestV1();
		request.setServiceUrl("http://122.19.77.226:8081/api/babycard/customer/V1/verify");

		BabyCardVerifyRequestBizV1 bizContent = new BabyCardVerifyRequestBizV1();
		bizContent.setTranType("1");
		bizContent.setCardNo("6212250200000002509");//宝贝卡
		bizContent.setName(URLEncoder.encode("一四八一"));
	    
		request.setBizContent(bizContent);
		BabyCardVerifyResponseV1 response = client.execute(request, "msgId");
		

		System.out.println(JSONObject.toJSONString(response));
		if (response.getVerResult() == 1&& response.isSuccess()) {
			// 业务成功处理
			System.out.println("宝贝卡校验通过");
		} else {
			// 失败
		}

	}
}

